import java.util.Scanner;

public class Test {
    //public static void main(String[] args) {
        /*int a = 1;
        int b = 2;
        System.out.println(a == 1 && b == 2); // 左为真 且 右为真 则结果为真
        System.out.println(a == 1 && b > 100); // 左为真 但 右为假 则结果为假
        System.out.println(a > 100 && b == 2); // 左为假 但 右为真 则结果为假
        System.out.println(a > 100 && b > 100); // 左为假 且 右为假 则结果为假*/


        /*int a = 1;
        int b = 2;
        System.out.println(a == 1 || b == 2);//左为真 且 右为真(无需计算) 则结果为真
        System.out.println(a == 1 || b > 100);//左为真 但 右为假(无需计算) 则结果也为真
        System.out.println(a > 100 || b == 2);//左为假 但 右为真 则结果也为真
        System.out.println(a > 100 || b > 100);//左为假 且 右为假 则结果为假*/


        /*int a = 1;
        System.out.println(!(a == 1));//a == 1 为true，取个非就是false
        System.out.println(!(a != 1));//a != 1 为false，取个非就是true*/


        /*int a = 10;
        int b = 20;
        double c = a > b? 1 : 2.0;
        System.out.println(c);*/


        /*int a = 10;
        int b = 20;
        a > b? 1 : 2.0;*/


        //判断一个数字是奇数还是偶数
    public static void main(String[]args){


        //从键盘上输入数据
/*        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        if(i % 2 == 1){
            System.out.println("是奇数");
        } else{
            System.out.println("是偶数");
        }
    */
        /*Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        if(i > 0) {
            System.out.println("是正数");
        } else if (i < 0) {
            System.out.println("是负数");
        } else {
            System.out.println("是0");
        }*/


        /*Scanner scanner = new Scanner(System.in);
        int year = scanner.nextInt();
        if (((year % 4 == 0)&&(year % 100 != 0)) || (year % 400 == 0)){
            System.out.println("是闰年");
        }else {
            System.out.println("不是闰年");
        }*/

        //求1~100之间有过少个数据包含9
        /*Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int count = 0;
        for (int i = 1; i <= n; i++) {
            //效率太慢了
            *//*while(i != 0){
                if(i % 10 == 9){
                    count++;
                }
                i /= 10;
            }*//*
            if(i % 10 == 9){
                count++;
            }else if((i/10) % 10 == 9){
                count++;
            }
        }
        System.out.println(count);*/


        //求素数（暴力穷举法）
        /*Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 1; i <= n; i++) {
            int j = 0;
            for ( j = 2; j < n; j++) {
                if(i % j == 0) {
                    break;
                }
            }
            if(i == j){
                System.out.println(i+"是素数");
            }
        }*/


        //(2~i/2)的方法
        /*Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 1; i <= n; i++) {
            int j = 0;
            for ( j = 2; j <= i/2; j++) {
                if(i % j == 0) {
                    break;
                }
            }
            if(j > i/2){
                System.out.println(i+"是素数");
            }
        }*/


        //辗转相除法求最大公约数
        /*int a = 24;
        int b = 18;
        int c = 24 % 18;
        while(c != 0){
            a = b;
            b = c;
            c = a % b;
        }
        System.out.println(b);*/


        /*double sum = 0;
        int flag = 1;
        for (int i = 1; i <= 100; i++) {
            sum += 1.0/i * flag;
            flag = -flag;
        }
        System.out.println(sum);*/


        //打印x图形
        /*Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if((i==j) || (i+j==n-1)){
                    System.out.print("*");
                }else{
                    System.out.print(" ");
                }
            }
            System.out.println();
        }*/


        //打印乘法口诀表（由用户自己决定输入n）
        /*Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(j+"*"+i+"="+j*i+"\t");
            }
            System.out.println("\n");
        }*/


        //打印水仙花数
        /*for (int i = 0; i < 100000; i++) {
            int tmp = i;
            int count = 0;
            //记录位数
            while(tmp != 0){
                count++;
                tmp /= 10;
            }
            tmp = i;
            int sum = 0;
            while(tmp != 0){
                sum += Math.pow(tmp%10, count);
                tmp /= 10;
            }
            if(sum == i){
                System.out.println(sum);
            }
        }*/


        //写一个函数返回参数二进制中 1 的个数
        /*Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int i = 0;
        int count = 0;
        while(n != 0){
            if((n & 1) == 1){
                count++;
                n>>>=1;
            }
        }
        System.out.println(count);*/


        //求一个二进制序列中所有的偶数位和奇数位
        /*Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.print("奇数位：");
        for (int i = 31; i >= 0; i--) {
            //奇数位
            if(i%2==1){
                System.out.print(((n>>>i)&1));
            }
        }
        System.out.println();
        System.out.print("偶数位：");
        for (int i = 31; i >= 0; i--) {
            //偶数位
            if(i%2==0){
                System.out.print(((n>>>i)&1));
            }
        }*/
    }
}
